/**
 * @projectName: LeetCode
 * @package: PACKAGE_NAME
 * @className: Jianzhioffer57
 * @author: Tongxinxin
 * @description: TODO
 * @date: 2025/9/21 18:27
 * @version: 1.0
 */
public class Jianzhioffer57 {
    public int[] twoSum(int[] price, int target) {
        int left=0;
        int right= price.length-1;
        while(left<right){
            if(price[left]+price[right]<target){
                left++;
            } else if (price[left]+price[right]>target) {
                right--;

            }else {
                break;
            }
        }
        return new int[]{price[left],price[right]};
    }
}
